<template>
	<view class="orderDetail">
		<view class="orderDetail-plate-1">
			<view class="item">
				<view class="item-left">
					<image src="../../../static/daizhifu2.png" mode="widthFix"></image>
					<text>{{orderArr.pay_status_name}}</text>
					<!-- <text>(剩余1119:16)</text> -->
				</view>
				<view class="item-right">
<!-- 					<text>去支付</text>
					<u-icon name="arrow-right" color="#fff" size="20"></u-icon> -->
				</view>
			</view>
		</view>
		<view class="orderDetail-plate-2">
			<view class="goods-top">
				<image :src="orderArr.goods_pic_one" mode=""></image>
				<view class="right">
					<text>{{orderArr.goods_name}}</text>
					<text>x{{orderArr.buy_num}}</text>
				</view>
			</view>
			<view class="goods-center">
				<view class="item">
					<text>商品总价</text>
					<text>¥{{orderArr.sub_prices}}</text>
				</view>
				<view class="item">
					<text>快递运费</text>
					<text>¥{{orderArr.logistics_fee}}</text>
				</view>
				<view class="item">
					<text>店铺优惠</text>
					<text>-{{orderArr.pay_cut_down}}</text>
				</view>
				<view class="item black">
					<text>订单总价</text>
					<text>¥{{orderArr.sub_total}}</text>
				</view>
			</view>
			<view class="goods-btm">
				<text>需付款</text>
				<text>¥{{orderArr.sub_total}}</text>
			</view>
		</view>
		<view class="orderDetail-plate-3">
			<view class="item">
				<text>订单编号：{{orderArr.order_sn}}</text>
				<button>复制</button>
			</view>
			<view class="item">
				<text>下单时间：{{orderArr.create_time}}</text>
			</view>
			<view class="item">
				<text>付款时间：{{orderArr.pay_time}}</text>
			</view>
			<view class="item">
				<text>订单来源：{{orderArr.order_from_name}}</text>
			</view>
			<view class="item">
				<text>付款类型：{{orderArr.pay_type_name}}</text>
			</view>
		</view>
		<view class="orderDetail-plate-4">
			<view class="item">
				<button class="border-btn">取消订单</button>
				<button class="bg-btn" @click="onPay">马上付款</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:0,
				orderArr:{}
				
			};
		},
		onLoad(option) {
			this.id = option.id
			this.getPageData()
		},
		methods:{
			// 去支付
			onPay(){
				uni.navigateTo({
					url:'../shop/goodsDetail/submitOrder/submitOrder?id=' + this.orderArr.goods_id
				})
			},
			// 请求订单详情
			getPageData(){
				uni.request({
				    url:this.$Url +'/index.php/App/Order/orderDetails',
				    method:'POST',
				    data:{
				       order_item_id:this.id
				    },
				    header:{
				        "token":uni.getStorageSync('token')
				    },
				    success: (res) => {
						if (res.data.status == 200) {
							this.orderArr = res.data.data.order_item_list
							let obj = {}
							for (let i = 0; i < this.orderArr.length; i++) {
								obj = Object.assign(this.orderArr[i])
							}
							this.orderArr = obj
						} else{
							uni.showToast({
								title:res.data.msg,
								icon:'none',
								duration:1200
							})
						}
				    }
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.orderDetail{
	width: 100vw;
	min-height: 100vh;
	background-color: #f7f7f7;
	.orderDetail-plate-1{
		width: 100vw;
		height: 150upx;
		background-image: linear-gradient(to right, #f7e7b3 , #dab767);
		display: flex;
		align-items: center;
		.item{
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 30upx;
			padding-top: 60upx;
			.item-left{
				display: flex;
				align-items: center;
				justify-content: center;
				image{
					width: 50upx;
					margin-right: 15upx;
				}
				text:nth-child(2){
					font-size: 40upx;
					color: #fff;
					margin-right: 10upx;
				}
				text:nth-child(3){
					font-size: 26upx;
					color: #fff;
				}
			}
			.item-right{
				text{
					font-size: 28upx;
					color: #fff;
					margin-right: 8upx;
				}
			}
		}
	}
	.orderDetail-plate-2{
		background-color: #fff;
		padding: 0 30upx;
		.goods-top{
			display: flex;
			align-items: center;
			padding-top: 10upx;
			image{
				width: 124upx;
				height: 124upx;
				margin-right: 20upx;
			}
			.right{
				display: flex;
				align-items: center;
				justify-content: space-between;
				width: 100%;
				text:first-child{
					color: #333;
					font-size: 26upx;
				}
				text:last-child{
					color: #999;
					font-size: 24upx;
				}
			}
		}
		.goods-center{
			.item{
				width: 100%;
				height: 60upx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				color: #999;
				font-size: 22upx;
			}
			.black{
				font-size: 28upx;
				color: #333;
				padding-bottom: 40upx;
				padding-top: 20upx;
				border-bottom: 1upx solid #f7f7f7;
			}
		}
		.goods-btm{
			width: 100%;
			height: 90upx;
			display: flex;
			align-items: center;
			justify-content: flex-end;
			text:first-child{
				font-size: 26upx;
				color: #333;
				margin-right: 10upx;
			}
			text:last-child{
				font-size: 26upx;
				font-weight: 600;
				color: red;
			}
		}
	}
	.orderDetail-plate-3{
		padding: 30upx;
		background-color: #fff;
		margin-top: 20upx;
		.item{
			display: flex;
			align-items: center;
			height: 50upx;
			text{
				font-size: 24upx;
				color: #999;
			}
			button{
				margin-left: 60upx;
				font-size: 22upx;
				color: #333;
				width: 110upx;
				height: 42upx;
				display: flex;
				align-items: center;
				justify-content: center;
				border-radius: 30upx;
				border: 1upx solid #b0b0b0;
				background-color: #fff;
			}
		}
	}
	.orderDetail-plate-4{
		width: 100vw;
		height: 100upx;
		padding: 0 30upx;
		background-color: #fff;
		position: fixed;
		bottom: 0;
		left: 0;
		.item{
			width: 100%;
			display: flex;
			align-items: center;
			height: 100upx;
			justify-content: flex-end;
			button{
				width: 150upx;
				height: 60upx;
				font-size: 22upx;
				margin: 0 15upx;
			}
			
		}
	}
}
</style>
